# from flask_restful import Resource, reqparse
# from models import QueryOneInstance, User, Role, Personal, QueryOrCreateOneInstance, \
#     QueryMultipleInstances, Like, Comment, Blog, Admin, UpdateInstance
# from restful.pack.user import PK_UserInfo
# from restful.parser import RP_UserInfo
# from restful.response import ResponseNotFound, ResponseSuccess
#
# class UserInfo(Resource):
#     def get(self,uid):
#         user = QueryOneInstance(User,{'id':uid})
#
#         if not user:
#             return ResponseNotFound("用户不存在")
#
#         return ResponseSuccess(data=PK_UserInfo(user))
#
#     def patch(self,uid):
#         args = RP_UserInfo()
#
#         user = QueryOneInstance(User,{'id':uid})
#         if not user:
#             return ResponseNotFound("用户不存在")
#
#         role = QueryOrCreateOneInstance(Role, {'uid': user.id})
#         personal = QueryOrCreateOneInstance(Personal, {'uid': user.id})
#
#         if args['role'] is not None:
#             role.role = args['role']
#         if args['part'] is not None:
#             role.part = args['part']
#         if args['intro'] is not None:
#             personal.intro = args['intro']
#         if args['icon'] is not None:
#             personal.img_icon = args['icon']
#         if args['background'] is not None:
#             personal.img_background = args['background']
#         UpdateInstance(role)
#         UpdateInstance(personal)
#         return ResponseSuccess("已更新")
